package src.lab02.test01.Test32;

import javax.print.DocFlavor;
import java.util.HashMap;
import java.util.Map;

public class Test {
    public static void main(String[] args) {
        Map<String,String>map=new HashMap<String, String>();
        //向MAP添加数据
        //ID->"1",name->"张三",gender->男,age->"25",love->学习Java
        map.put("id","1");
        map.put("name","张三");
        map.put("gender","男");
        map.put("age","25");
        map.put("love","学习Java");
        //遍历一个Map
        for (Map.Entry<String,String>entry:map.entrySet()){
            System.out.println(entry.getKey()+":"+entry.getValue());
        }
        System.out.println("集合的大小："+map.size());
        //删除集合后的键为age的元素
        for (Map.Entry<String,String>entry:map.entrySet()){
            if (entry.getKey().equals("age")){
                map.remove(entry.getKey());
            }

        }
        System.out.println("集合的大小："+map.size());

    }
}
